#include "mapbridge.h"
#include<QDebug>
#include <QWebEngineView>
#include <QWebChannel>
#include <QVariantMap>

MapBridge::MapBridge(QObject *parent) : QObject(parent)
{

}

void MapBridge::addMapsTips(double lng, double lat, QString prjName, QString prjState, int iState)
{
    // 通过QWebChannel将数据传递给JavaScript
    if (m_pview) {
        QString script = QString("addTips(%1, %2, '%3', '%4', '%5')").arg(lng).arg(lat).arg(prjName).arg(prjState).arg(iState);
        m_pview->page()->runJavaScript(script);
    }
}

void MapBridge::setViewPtr(QWebEngineView*& pview)
{
    m_pview = pview;
}

void MapBridge::slotSelected(double lng, double lat, QString prjName)
{
//    qDebug() << "提示框被点击，经度：" << lng << "，纬度：" << lat << "，项目名：" << prjName;
}
